﻿using System;
using System.Collections.Generic;

namespace IDesktop.Core
{
    /// <summary>
    /// 地区以及天气信息
    /// </summary>
    [Serializable]
    public class Location
    {
        private IList<Location> _children;

        /// <summary>
        /// 城市的代码
        /// </summary>
        public string LocationID {
            get;
            set;
        }

        /// <summary>
        /// 城市的名称
        /// </summary>
        public string LocationName {
            get;
            set;
        }

        /// <summary>
        /// 此地区所属的区域
        /// </summary>
        public Location Parent {
            get;
            set;
        }

        /// <summary>
        /// 此城市的下属城市
        /// </summary>
        public IList<Location> Children {
            get {
                if (_children == null) {
                    _children = new List<Location>();
                }
                return _children;
            }
            set {
                if (value != null) {
                    _children = value;
                }
            }
        }
    }
}
